import Vue from 'vue'
import VueRouter from 'vue-router'
const Index = () => import('../views/index/Index.vue')
const List = () => import('../views/list/List.vue')
const ArtView = () => import('../views/artView/ArtView.vue')
const InsView = () => import('../views/ins/InsView.vue')
const Detail = () => import('../views/detail/Detail.vue')
const demo = () => import('../views/demo/demo.vue')
const Search = () => import('../views/search/Search.vue')

Vue.use(VueRouter)

const routes = [
  {
    path: '',
    redirect: '/index'
  },
  {
    path: '/index',
    component: Index,
    meta: {
      keepAlive: true,
      title: '首页-青年帮酷站推荐移动端'
    }
  },
  {
    path: '/list',
    component: List,
    meta: {
      keepAlive: true,
      title: '列表-青年帮酷站推荐移动端'
    }
  },
  {
    path: '/art',
    component: ArtView,
    meta: {
      keepAlive: true,
      title: '文章干货-青年帮酷站推荐移动端'
    }
  },
  {
    path: '/ins',
    component: InsView,
    meta: {
      keepAlive: true,
      title: '灵感推荐-青年帮酷站推荐移动端'
    }
  },
  {
    path: '/detail',
    component: Detail,
    meta: {
      title: '详情内容'
    }
  },
  {
    path: '/search',
    component: Search,
    meta: {
      title: '搜索页面',
      keepAlive: true
    }
  },
  {
    path: '/demo/:id/:num',
    component: demo
  }
]
const router = new VueRouter({
  mode: 'hash',
  routes
})
router.beforeEach((to, from, next) => {
  document.title = to.meta.title
  next()
})
export default router
